* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    background-color: #f0f2f5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

header {
    grid-column: 1 / -1;
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #1a1a1a;
    margin-bottom: 20px;
    font-size: 2.5em;
}

.game-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

button, select {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background-color: #4a90e2;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #357abd;
}

select {
    background-color: #fff;
    color: #333;
    border: 1px solid #ddd;
}

.game-info {
    text-align: center;
    margin-bottom: 20px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 1.2em;
}

.game-board {
    display: grid;
    gap: 10px;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    max-width: 500px;
}

.tile {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #4a90e2;
    color: white;
    font-size: clamp(1rem, 2.5vw, 1.5em);
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.3s ease;
    user-select: none;
}

.tile:hover {
    transform: scale(1.05);
}

.tile.empty {
    background-color: transparent;
    border: 2px dashed #ddd;
}

.background-controls {
    text-align: center;
    margin-top: 20px;
}

.achievements {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.achievements h2 {
    color: #1a1a1a;
    margin-bottom: 15px;
    text-align: center;
}

.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.achievement {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 10px;
    border-radius: 4px;
    background-color: #f8f9fa;
    transition: transform 0.2s;
}

.achievement:hover {
    transform: translateX(5px);
}

.achievement-icon {
    font-size: 1.5em;
    grid-row: span 2;
    display: flex;
    align-items: center;
}

.achievement-name {
    font-weight: bold;
    color: #1a1a1a;
}

.achievement-desc {
    color: #666;
    font-size: 0.9em;
    grid-column: 2;
}

.achievement.unlocked {
    background-color: #e3f2fd;
    border: 1px solid #4a90e2;
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
    }

    .game-controls {
        flex-wrap: wrap;
    }

    .game-board {
        max-width: 100%;
    }

    .achievements {
        margin-top: 20px;
    }
}

/* 移动动画 */
@keyframes slideTile {
    from {
        transform: scale(0.8);
        opacity: 0.5;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.tile.moving {
    animation: slideTile 0.3s ease;
}

/* 胜利动画 */
@keyframes victory {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.game-board.victory .tile {
    animation: victory 0.5s ease;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    position: relative;
    background-color: #fff;
    margin: 15% auto;
    padding: 20px;
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
}

.close:hover {
    color: #333;
}

.rules-content {
    margin-top: 20px;
}

.rules-content p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.rules-content ol {
    padding-left: 20px;
    margin-bottom: 15px;
}

.rules-content li {
    margin-bottom: 10px;
    line-height: 1.6;
}